package com.tanguy.user.ui.me.adapter

import android.view.View
import com.tanguy.user.R
import com.tanguy.user.base.JustAdapter
import com.tanguy.user.bean.RechargeRecord
import com.tanguy.user.utlis.TimeUtils
import com.tanguy.user.utlis.extend.setText
import com.tanguy.user.utlis.extend.toTimeString
import java.util.*

/**
 * Created by dab on 2017/10/10 0010 11:17
 */
class RechargeRecordAdapter(data: ArrayList<RechargeRecord>) : JustAdapter<RechargeRecord>(data, R.layout.item_recharge_record) {
    override fun bind(itemView: View, data: RechargeRecord, position: Int) {
        itemView.apply {
            setText(R.id.tv_time, data.addtime.toTimeString(TimeUtils.TIME_YYYY_MM_DD_HH_MM))
            val priceString = String.format(Locale.CHINA, "充值%.2f元，赠送%.2f元", data.money, data.zengsong)
            setText(R.id.tv_des, priceString)
            setText(R.id.tv_total, String.format(Locale.CHINA, "合计：%.2f", data.money + data.zengsong))
        }

    }


}